package com.base.cn.platform.os.service.manage.order.goods;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 订单流水接口
 *
 * @author s.li
 * @create 2018-05-15-14:14
 */
@FeignClient(name = BaseService.appName,configuration = FeignAuthConfig.class)
public interface OrderDetailsService extends BaseService {

    /**
     * 查询订单列表
     * @param condition 查询条件
     * @return
     */
    @RequestMapping(contextPath + "/order/findOrderDetailsList")
    List<Map<String,Object>> findOrderDetailsList(@RequestBody Map<String,Object> condition);

    /**
     * 分页查询订单流水数据
     * @param condition 查询条件
     * @param setUserData 是否设置用户数据
     * @param setShopData 是否设置商品数据
     * @param setOrderBook 是否设置图书订单扩展数据
     * @return PageInfo<OrderDetails>
     */
    @RequestMapping(contextPath + "/order/findOrderDetailsPage")
    Map<String,Object> findOrderDetailsPage(@RequestBody Map<String, Object> condition,
                                            @RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                            @RequestParam("setUserData") boolean setUserData,
                                            @RequestParam("setShopData") boolean setShopData,
                                            @RequestParam("setOrderBook") boolean setOrderBook);

    /**
     * 通过ID，查询流水数据
     * @param id 流水ID
     * @param setUserData  是否设置用户数据
     * @param setShopData 是否设置商品数据
     * @param setOrderBook 是否设置图书订单扩展数据
     * @return OrderDetails
     */
    @RequestMapping(contextPath + "/order/findOrderDetailsInfo")
    Map<String,Object> findOrderDetailsInfo(@RequestParam("id") BigDecimal id,
                                            @RequestParam("setUserData") boolean setUserData,
                                            @RequestParam("setShopData") boolean setShopData,
                                            @RequestParam("setOrderBook") boolean setOrderBook);

    /**
     * 修改订单流水状态
     * @param sysUserId 登录用户ID
     * @param id 流水ID
     * @param detailsStatus 状态
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/order/updateOrderDetailsStatus")
    Map<String,Object> updateOrderDetailsStatus(@RequestParam("sysUserId") BigDecimal sysUserId,
                                                @RequestParam("id") BigDecimal id,
                                                @RequestParam("detailsStatus") String detailsStatus);

    /**
     * 获取购买课程的用户Ids
     * @param courseIds
     * @return
     */
    @RequestMapping(contextPath + "/order/queryBuyCourseUserCountByCourseIds")
    Map<BigDecimal,String> queryBuyCourseUserCountByCourseIds(String courseIds);

   /**
     * @param condition 查询条件
     * @param currentPage 页码
     * @param pageSize 数据显示数量
     * @param setUserData 是否设置用户数据
     * @param setShopData 是否设置商品数据
     * @param setOrderBook 是否设置图书订单扩展数据
     * @param setOrder 是否设置订单扩展数据
     * @return
             */
    @RequestMapping(contextPath + "/order/findOrderDetailsSpecialPage")
    Map<String,Object>  findOrderDetailsSpecialPage(@RequestBody Map<String, Object> condition,
                                                    @RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                                    @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
                                                    @RequestParam("setUserData") boolean setUserData,
                                                    @RequestParam("setShopData") boolean setShopData,
                                                    @RequestParam("setOrderBook") boolean setOrderBook,
                                                    @RequestParam("setOrder") boolean setOrder);


    /**
     * 导出订单明细数据表格
     * @param condition
     * @param pageSize
     * @param distinguish
     * @return
     * @throws Exception
     */
    @RequestMapping(contextPath + "/order/downloadExcelOrdersDetailsList")
    ResponseEntity<byte[]> downloadExcelOrdersDetailsList(@RequestBody Map<String, Object> condition,
                                                          @RequestParam(value = "pageSize") int pageSize, @RequestParam("distinguish") String distinguish) throws Exception;
}
